package finance

import grails.test.*

class TheoDistServiceTests extends GrailsUnitTestCase {
    protected void setUp() {
        super.setUp()
    }
    
    protected void tearDown() {
        super.tearDown()
    }
    
    def theoDistService
    
    void testNormalPDF() {
        assertEquals 1/ Math.sqrt(2 * Math.PI), theoDistService.normalPDF(0, 1, 0)	
        assertEquals 1/ Math.sqrt(2 * Math.PI), theoDistService.normalPDF(1, 1, 1)
    }
    
    void testGaussExpected() {
        def xpoints = [1 : 0, 0 : 0].keySet()
        def result = theoDistService.gaussExpected(0, 1, xpoints)
        assertEquals result[0], 1/ Math.sqrt(2 * Math.PI)
        assertEquals result[1], Math.exp(-0.5)/ Math.sqrt(2 * Math.PI)
    }
}
